package com.lottery.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lottery.entity.LotteryPrize;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface LotteryPrizeMapper extends BaseMapper<LotteryPrize> {
    
    /**
     * 扣减奖品库存
     */
    @Update("UPDATE lottery_prize SET remaining_quantity = remaining_quantity - 1 " +
            "WHERE prize_id = #{prizeId} AND remaining_quantity > 0")
    int decreaseStock(Integer prizeId);
} 